package org.dfl.core.model.analysis;

import java.util.HashMap;
import java.util.Map;

public class VariableNameFactory {
	Map<String, Integer> map = new HashMap<String, Integer>();
	static private VariableNameFactory instance = new VariableNameFactory();
	
	public static VariableNameFactory getInstance() {
		return instance;
	}
	
	private VariableNameFactory() {}
	
	public String getUniqueVariableName(String v) {
		Integer i = map.get(v);
		if (i == null) i = 0;
		map.put(v, i+1);
		return "$\"" + v + i + "\"";
	}
	
	static public String getUVN(String s) {
		return getInstance().getUniqueVariableName(s); 
	}
	
	//public void test() {
	//	VariableNameFactory.getInstance().getUniqueVariableName("ala");
	//	VariableNameFactory.getUVN("ala");
	//}
}
